<!DOCTYPE html>
<title>SpeechSynthesisUtterance: Basic interface tests</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script>
setup(function() {
  if (window.internals)
    internals.enableMockSpeechSynthesizer(window);
});

test(function() {
  var utterance = new SpeechSynthesisUtterance(" ");
  var restrictedFloatAttributes = [ 'volume', 'rate', 'pitch' ];
  for (var i in restrictedFloatAttributes) {
    var attr = restrictedFloatAttributes[i];
    var before = utterance[attr];
    assert_throws_js(TypeError, function() { utterance[attr] = NaN; }, attr);
    assert_throws_js(TypeError, function() { utterance[attr] = Infinity; }, attr);
    assert_equals(utterance[attr], before, 'value is unchanged.');
  }
}, 'SpeechSynthesisUtterance, setting non-finite values.');
</script>
